/*
 *  thermoelastic.h
 *  EPPI-0.0
 *
 *  Created by Sergio Conde Martin on 26/10/12.
 *
 */
 
#ifndef _thermoelastic_h_
#define _thermoelastic_h_

#include <iostream>
#include <sstream>
#include "MATERIALS/material.h"

using namespace std;

class Thermoelastic : public Material
{
public:
	Material *matHyper;

    bool stVar;           	// State variable T or s??
    double T0;              // Reference Temperature
    double a;               // Linear expansion coefficient
    double c0;              // Specific heat capacity
    double K0;              // Conductivity at T = T0
    double wk;              // Softening parameter
    double gam;             // Exponential parameters for function G(J)
    double beta;			// Linear coefficient of thermal expansion G(J) = - 3 * beta * dU(J) / dJ
    string FourierType;

    double G; 				// Takes care of effects of thermal expansion
    VectorXd dG;			// Derivative respect to C of G
    VectorXd dcT;			//
    double dsT;				//
    VectorXd Ci;			//
	
public:
        Thermoelastic();
        Thermoelastic(ifstream &, const string &, const string &,  Material*);
        ~Thermoelastic(){}
	
        /** Virtual functions from base */
	
        void calcW(const VectorXd &, const double &);
        void calcU(const VectorXd &, const double &);          // Computes the internal energy in terms of C and ent.
        void calcEntropy(const VectorXd &, const double &);    // Computes the entropy in terms of C and T

        void calcS( const VectorXd &, const double & );	        // Computes the thermoelastic Second Piola-Kirchoff Stress Tensor in terms of C and S
        
        void calcCt( const VectorXd &, const double & );

        void calcTemp(const VectorXd &, const double &);
        void calcConductivity(const double &);
        
        double getT0();              // Reference Temperature
        double geta();               // Linear expansion coefficient
        double getc0();              // Specific heat capacity
        double getK();               // Conductivity at T
        double getK0();              // Conductivity at T = T0
        double getwk();              // Softening parameter
        bool getMode();

        /**Local Function */
        
        void calcG(const double & );
        void calcDG(const VectorXd & );
        void calcDcTemp(const VectorXd &, const double &);
        void calcDsTemp(const VectorXd &, const double &);
};

#endif	
	
